package com.wyl.template.service.impl;

import com.wyl.template.domain.dto.SysRoleDTO;
import com.wyl.template.mapper.SysRoleMapper;
import com.wyl.template.mapper.SysUserRoleMapper;
import com.wyl.template.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: wyl
 * @Date: 2021/4/29
 * @Description:
 */
@Service
@Slf4j
public class RoleServiceImpl implements RoleService {

    @Autowired
    private SysRoleMapper roleMapper;
    @Autowired
    private SysUserRoleMapper userRoleMapper;

    @Override
    public List<SysRoleDTO> listRoleByUser(Long userId) {
        return null;
    }

/*    @Override
    public List<SysRoleDTO> selectRoleByUser(Long userId) {

        SysUserRoleDO  userRoleDO = new SysUserRoleDO();
        userRoleDO.setUserId(userId);
        QueryWrapper queryWrapper = new QueryWrapper(userRoleDO);

        List<SysUserRoleDO> userRoleList = userRoleMapper.selectList(queryWrapper);

        List<Long> roleIds = userRoleList.stream().map(item->{
            return item.getRoleId();
        }).collect(Collectors.toList());

        QueryWrapper roleQueryMapper = new QueryWrapper();
        roleQueryMapper.in("id",roleIds);
        List roleList = roleMapper.selectList(roleQueryMapper);

        return roleList;
    }*/
}
